﻿Imports System.Xml.Linq

Public Class CriterionHandler
    Implements ICriterionUIHandler

    Public Overridable Sub processCriterion(ByVal ctrl As System.Windows.Forms.Control, _
                             ByVal crit As CriterionMetadata) _
                Implements ICriterionUIHandler.renderControlHandler

        If crit.Name = "BooleanCombo" Then
            Dim c As ComboBox = CType(ctrl, ComboBox)
            Dim obj As XDocument = <?xml version="1.0"?>
                                   <booleans>
                                       <entry Id="" Description="&lt;-- All --&gt;"/>
                                       <entry Id="0" Description="NO"/>
                                       <entry Id="1" Description="YES"/>
                                   </booleans>

            Dim ds As New DataSet
            ds.ReadXml(obj.CreateReader)
            c.DataSource = ds.Tables(0)
            c.DisplayMember = "Description"
            c.ValueMember = "Id"
            'AddHandler c.SizeChanged, AddressOf citensloaded
        End If

    End Sub

    Public Sub controlValueHandler(ByRef value As Object, ByVal c As System.Windows.Forms.Control, ByVal crit As CriterionMetadata) Implements ICriterionUIHandler.controlValueHandler

    End Sub


    Public Sub controlDisplayValueHandler(ByRef value As String, ByVal c As System.Windows.Forms.Control, ByVal crit As CriterionMetadata) Implements ICriterionUIHandler.controlDisplayValueHandler

    End Sub
End Class

